var BASE_URL = document.scripts[document.scripts.length - 1].src.substring(0, document.scripts[document.scripts.length - 1].src.lastIndexOf("/") + 1);
window.BASE_URL = BASE_URL;
base_pat ='plugs/cpjs/src/';
var path = {
    //css
    "css": [base_pat+"/lib/css.min"],
    //jquery
    "jquery": [base_pat+"lib/jquery/jquery_v3.5.1.min"],
    "jqueryForm": [base_pat+"lib/jquery/jquery.form.min"],
    "jqform": [base_pat+"module/jquery-form"],
    "jq_request": [base_pat+"module/jquery-request"],
    "helper": [base_pat+"module/helper"],

    //layer layui
    "layer": [base_pat+"lib/layer-v3.1.1/layer/layer"],
   /* "layui": [base_pat+"lib/layui/layui"],
    "layuiall": [base_pat+"lib/layui/layui.all"],*/
    //"layui": [base_pat+"lib/layui-v2.6.6/layui/layui"],
    "layuiall": [base_pat+"lib/layui-v2.6.8/layui"],

    //webupload
    "webupload": [base_pat+"lib/webupload/webuploader.min"],
    //vue
    "vue": [base_pat+"lib/vue/vue-v2.6.12"],

    "vue-axio": [base_pat+"lib/vue/axio-v2.0"],

    "jqueryV14": ["/static/plugs/zTree_v3/js/jquery-1.4.4.min"],

    "zTree":["/static/plugs/zTree_v3/js/jquery.ztree.all.min"],

    'baidueditor': '/static/plugs/ueditor/ueditor.all.min',

    'ueditorconfig': '/static/plugs/ueditor/ueditor.config',

    'zeroclipboard': '/static/plugs/ueditor/third-party/zeroclipboard/ZeroClipboard',

    'xmSelect': '/static/plugs/cpjs/src/lib/layui-module/xmSelect/dist/xm-select'

};
var shims = {
    'layer': ["css!"+base_pat+"lib/layer-v3.1.1/layer/theme/default/layer.css"],
    'layuiall': {
        deps: ['layer'],
        exports: 'layuiall',
        init:function(){
            return this.layui.config({
                base:BASE_URL+base_pat+'lib/layui-module/'
            }).extend({
                selectInput: 'selectInput/selectInput',
            });
        }
    },
    "zTree":{
        deps: [
            "css!/static/plugs/zTree_v3/css/zTreeStyle/zTreeStyle.css",
            "jquery",
        ]
    },
    "xmSelect":{
        deps: [
            "css!",
            // "jqueryV14"
        ]
    },
    'baidueditor': {
        //注意：此处的依赖顺序不能颠倒
        deps: ['zeroclipboard','ueditorconfig'],
        exports: 'UE',
        init:function(ZeroClipboard){
            window.ZeroClipboard = ZeroClipboard;
        }
    }
};
require.config({
    baseUrl: BASE_URL
    , urlArgs: 'v=' + (new Date()).getTime()
    , paths: path
    , shim: shims
});

// 初始化控制器对应的JS自动加载
if ("undefined" != typeof CONFIG.AUTOLOAD_JS && CONFIG.AUTOLOAD_JS) {
    require([BASE_URL + CONFIG.CONTROLLER_JS_PATH], function (Controller) {
        if (eval('Controller.' + CONFIG.ACTION)) {
            eval('Controller.' + CONFIG.ACTION + '()');
        }
    });
}

